<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .div1 {
        position: relative;
        margin: 0 auto;
        width: 400px;
        height: 400px;
        border: 1px solid #555;
        background-color: aqua;
        text-align: center;
      }

      .box {
        position: absolute;
        top: 50px;
        left: 50px;
        width: 200px;
        height: 200px;
        background-image: url(2.png);
        line-height: 100px;
        border: 1px solid #ccc;
        overflow: hidden; /* 隐藏溢出部分，保证只显示父容器范围内的内容 */

        /* animation: mymove 3s ease; */
        /* -moz-animation: ; */
      }

      .subimg {
        display: block;
        width: 100%;
        height: 100%;
        background-image: url(2.png);
        /* background-size: 100% 100%; */
        animation: mymove 1s ease-in-out; /* 动画效果：1秒钟完成，从底部往上逐步显示 */
      }

      @keyframes mymove {
        0% {
          background-position: 0 0; /* 背景图初始位置 */
        }
        100% {
          background-position: 0 -100%; /* 背景图结束位置，显示完整图像 */
        }
      }
    </style>
  </head>
  <body>
    <div class="div1">
      <div class="box">
        <div class="subimg"></div>
      </div>
    </div>
  </body>
</html>
